]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
background: Clarify the intent of the code
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 3 Dec 2013 23:08:42 +0000 (18:08 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Wed, 4 Dec 2013 00:13:12 +0000 (19:13 -0500)
Stomping on local variables and trying to keep loop state isn't
too fun. Just use a new variable here so we aren't too confused
with what we're doing.

https://bugzilla.gnome.org/show_bug.cgi?id=719803

js/ui/background.js

index 79e58a7f04bf0c5949f6411eae66fb4a2fbf8d3e..1d9f55c8a647f0ce9602f7fcf2b62bdca1e6567c 100644 (file)
@@ -183,13 +183,16 @@ const BackgroundCache = new Lang.Class({
 
                                                   for (let j = 0; j < pendingLoad.callers.length; j++) {
                                                       if (pendingLoad.callers[j].onFinished) {
-                                                          if (content && pendingLoad.callers[j].shouldCopy) {
-                                                              content = object.copy(pendingLoad.callers[j].monitorIndex,
-                                                                                    pendingLoad.callers[j].effects);
+                                                          let newContent;
 
+                                                          if (content && pendingLoad.callers[j].shouldCopy) {
+                                                              newContent = content.copy(pendingLoad.callers[j].monitorIndex,
+                                                                                        pendingLoad.callers[j].effects);
+                                                          } else {
+                                                              newContent = content;
                                                           }
 
-                                                          pendingLoad.callers[j].onFinished(content);
+                                                          pendingLoad.callers[j].onFinished(newContent);
                                                       }
                                                   }